import React, { Component, ComponentClass } from 'react';
import Taro from '@tarojs/taro';
import Skeleton from 'taro-skeleton'
import {Block, View, Text, Image, ScrollView, Button} from '@tarojs/components';
import {AtIcon, AtTabs, AtFloatLayout, AtCalendar, AtModal, AtModalHeader, AtModalAction, AtCountdown} from 'taro-ui';
import {connect} from 'react-redux';
import {DateType} from '../../reducers/select-date';
import {platform} from '../../utils/platform-settting.service';
import Calendar from '../components/calendar/calendar-new'
import PopView from '../pop/popView'
import {
  SiteInfo,
  Good,
  LimitOtherGood,
  UpDataDetail,
  ReserveGoods,
  PlatformSet, SubscriptionType
} from '../../utils/server.interface';
import {http} from '../../utils/http';
import JoinTt from '../components/join-tt/join-tt'
import {
  NEW_GOOD_DETAIL,
  SITE_INFO,
  LIMIT_APPOINTMENT,
  LIMIT_LIST_APPOINTMENT,
  LIMIT_FROM_SELLER_SINCE,
  NEW_GOOD_DETAIL_ON,
  OFF_USER_SALE_SUB,
  RESOURCE_URL,
  TARO_ENV,
  ROOKIEGUID_TASK_RECORD,
  SUPPLIER_STORE_LIST,
  QGODUCT_GROUP_ACTIVITY_INFO,
  GOODS_EVALUATION_APP_LIST,
  CONTENT_QR,
  BUBBLE_GET_INFO,
  CONTENT_QRWX,
  ADD_SHARE_VOLUME,
  ACTIVITY_CHECK,
  OPEN_ACTIVITY_CHECK, UPDATE_USER_SHARE_DATE, SHARE_SHARE_INFO, SHARE_USER_SHARE_INFO, SCAN_BIND_SELLER,
  IDENTITY_IS_SELLER, IDENTITY
} from '../../constants/api';
import fetchNewGoodsList from "../../utils/fetchNewGoodsList";
import {getSharePoster, getPoster} from '../../utils/poster.service'
import {user} from '../../utils/user.service';
import ProductName from '../components/product-name/product-name';
import EnterStore from '../components/enter-store/enter-store';
import LimitBar from '../components/detail-bar/limit-bar';
import DetailHeader from '../components/detail-header/detail-header';
import JoinTtGroup from '../components/join-tt-group/join-tt-group';
import {location} from '../../utils/location.service';
import {
  getHeadTop,
  GetRequest,
  lastMinute,
  vcmonitor,
  setTempSellerId,
  getTempSellerId,
  throttle, isPc,
  keepSearch
} from '../../utils/tools';
import MakePoster from '../components/make-poster/make-poster';
import SupportBar from '../../components/support-bar/support-bar';
import LiveBar from '../components/live-bar/live-bar';
import {newHttp} from "../../utils/request";
import JoinWx from "../components/join-wx/join-wx";
import Subscription from "../../components/subscription";
import GzhAuth from "../../components/gzh-auth/gzh-auth"
import GroupIndex from "../group/index"
import {h5Wx} from "../../utils/h5.service";
import Evaluation from "../components/evaluation/evaluation";
import Headercar from "../components/header-car/header-car";
import statistics from '../statistics/statistics'
import GoodInfoBox from "../components/good-info-box/good-info-box";
import Category from "../../pages/index/template/regionalCategory/component/category";
import {lxH5Wx} from "../../utils/lx.h5.service";
import {getBdInfo, getMemberAdvertisement} from "../../utils/getCommonData";
import AdvertisementMember from "../../components/advertisement/member";
import {handlerCollection, handlerRichImage, getContent, getLongUrl} from "../../utils/handlerPublicCode";
import '../scenic/detail.scss';
import './detail.scss';
import SiteBox from "./siteBox";

const status: { [key: string]: number } = {selling: 1, beginning: 0, ending: 99, sellout: -1};
type PageStateProps = {
  selectDate: DateType
}

type PageDispatchProps = {}

type PageOwnProps = {}

type PageState = {
  goodstext: string
  is_favorite: number
  isShowShareButton: boolean
  isUser: boolean
  notOpen: boolean
  power: boolean
  popInfo: any
  force_platform_seller: any
  pkeys: any
  limitGoodsId: any
  goodsDiscountCodeType: any
  goodsDiscountCodeId: any
  isOpened: boolean
  minHeight: any
  groupDetail: any
  userPower: any
  memberAdvertisement: any
  sloganList: any
  shareSetting: any
  itemId: string
  orderNum: string
  bdInfo: any
  goodUuid: any
  groupBuyId: any
  itemName: string
  sharePoster: false | { url: string }
  showCalendar: boolean
  height: number
  good: any
  siteInfo: SiteInfo | false
  tabIndex: number
  evaluationList: any
  recordsTotal: any
  tabs: { title: string; name: 'meal' | 'notice' | 'desp' | 'appointment' | 'recommend' | 'evaluation' }[]
  recommendGood: Good[]
  sitePhone: string
  is_subscribe: number
  siteServiceWx: string
  floatLayout: boolean
  notice: string
  showLoading: boolean
  goodStatus: number
  isLogin: boolean
  btnDisabled: boolean
  otherGood: LimitOtherGood[]
  reserveGoods: ReserveGoods[]
  showAppointment: boolean
  bindSellerId: number
  calendarArr: { value: string }[]
  openGroup: boolean
  platformSet?: PlatformSet
  oneMinute: boolean
  upDataDetail: UpDataDetail | false
  notices: string
  description: string
  checkmeal: any
  searchBarTop: any
  openMp: SubscriptionType | false
  showNum: number
  tempSellerId: string
  supplierStoreList: any
  modalShow: boolean
  qrImg: any
  qrImgDescribe: any
  wxModalShow: boolean
  wxQrImg: any
  currentIndex: number
  currentFlag: boolean
  refundLabels: any
}

type IProps = PageStateProps & PageDispatchProps & PageOwnProps

interface DetailWeb {
  props: IProps
}

@connect(({selectDate}) => ({
  selectDate,
}), () => ({}))

class DetailWeb extends Component {
  state: PageState = {
    goodstext: '可用时间',
    isShowShareButton: true,
    isUser: true,
    notOpen: false,
    popInfo: false,
    groupDetail: null,
    power: false,
    isOpened: false,
    minHeight: 0,
    sloganList: [],
    userPower: '',
    memberAdvertisement: '',
    shareSetting: [],
    bdInfo: false,
    orderNum: '',
    goodUuid: '',
    groupBuyId: '',
    itemId: '',
    itemName: '',
    sharePoster: false,
    showCalendar: false,
    height: 550,
    is_subscribe: 0,
    good: false,
    siteInfo: false,
    tabIndex: 0,
    evaluationList: [],
    recordsTotal: 0,
    tabs: [],
    recommendGood: [],
    sitePhone: '',
    siteServiceWx: '',
    floatLayout: false,
    notice: '',
    showLoading: true,
    goodStatus: 1,
    btnDisabled: false,
    isLogin: false,
    otherGood: [],
    reserveGoods: [],
    showAppointment: false,
    bindSellerId: 0,
    calendarArr: [],
    openGroup: false,
    oneMinute: false,
    upDataDetail: false,
    notices: '',
    description: '',
    checkmeal: [],
    openMp: false,
    showNum: 3,
    searchBarTop: 0,
    tempSellerId: '',
    supplierStoreList: [],
    modalShow: false,
    qrImg: '',
    qrImgDescribe: '',
    limitGoodsId: '',
    force_platform_seller: '',
    pkeys: '',
    goodsDiscountCodeType: '',
    goodsDiscountCodeId: '',
    wxModalShow: false,
    wxQrImg: '',
    is_favorite: 0,
    currentIndex: 0,
    currentFlag: false,
    refundLabels: []
  }

  async UNSAFE_componentWillMount() {
    vcmonitor(this)
    const isH5 = TARO_ENV === 'h5'
    const platformSet = await platform.getSetting()
    isH5 && keepSearch()
    Taro.getSystemInfo({
      success: (res) => {
        this.setState({minHeight: res.windowHeight / 2 - 60})
      }
    })
    let id = '';
    let isId = false;
    const {
      scene = '',
      mpkey = '',
      force_platform_seller = '',
      groupBuyId = '',
      orderNum = '',
      itemId = '',
      goodsId = '',
      goodsDiscountCodeType = '',
      goodsDiscountCodeId = '',
      pkeys = ''
    } = Taro.getCurrentInstance().router.params
    const goodUuid = itemId
    const limitGoodsId = goodsId
    const headTop: any = getHeadTop()
    const searchBarTop = process.env.TARO_ENV === 'tt' ? 0 : headTop.statusBar > 20 ? (headTop.statusBar + headTop.top + 40) : (headTop.statusBar + headTop.top + 50)
    const bdInfo = await getBdInfo()
    this.setState({
      bdInfo,
      orderNum,
      goodUuid,
      searchBarTop,
      groupBuyId,
      pkeys,
      force_platform_seller,
      limitGoodsId,
      goodsDiscountCodeType,
      goodsDiscountCodeId
    })
    let bindSellerId = Taro.getStorageSync('bindSellerId') || 0;
    if (scene && (/^\d+_\d+_\d+$/.test(scene) || /^\d+_\d+_\d+_\d+$/.test(scene))) {
      platform.scene = 0;
      const paramArr = scene.split('_');
      if (!paramArr[0] || !paramArr[1] || !paramArr[2]) {
        Taro.showToast({
          title: '无效的参数',
          icon: 'none'
        });
        Taro.switchTab({url: '/pages/index/index'})
        return false;
      }
      if (paramArr[3]) {
        const tempSellerId = paramArr[3]
        setTempSellerId(tempSellerId)
        this.setState({tempSellerId})
      }
      id = paramArr[0];
      isId = true
      if (platformSet.isSellerPermanentLock) {
        if (!bindSellerId) {
          bindSellerId = paramArr[2];
        }
      } else {
        bindSellerId = paramArr[2];
      }
    } else {
      const tempSellerId = getTempSellerId(this)
      this.setState({tempSellerId})
      if (platformSet.isSellerPermanentLock) {
        if (!bindSellerId) {
          bindSellerId = Taro.getCurrentInstance().router.params.bindSellerId || bindSellerId;
        }
      } else {
        bindSellerId = Taro.getCurrentInstance().router.params.bindSellerId || bindSellerId;
      }
      if (!Taro.getCurrentInstance().router.params || !itemId) {
        Taro.showToast({
          title: '无效的参数',
          icon: 'none'
        });
        Taro.navigateBack();
        return false;
      }
      id = itemId
    }
    user.bindSellerId = bindSellerId
    Taro.setStorage({
      key: 'bindSellerId',
      data: user.bindSellerId,
    })
    const detail = await this.getDetailData(id, bindSellerId, isId);
    if (!detail) return false
    if (detail && detail.images && detail.images.length > 0) {
      try {
        await Taro.getImageInfo({
          src: detail.images[0].url + "?x-oss-process=image/resize,w_750",
          success: (res) => {
            const b = 750 / res.width
            this.setState({height: res.height * b})
          }
        })
      } catch (e) {
      }
    }
    if (isH5 && process.env.NODE_ENV !== 'development') {
      await user.mpKeyCheckLogin(mpkey, 0, detail.uuid || '')
    }
    if (isH5 && goodsDiscountCodeType) {
      statistics()
    }
    if (!isH5 && bindSellerId) {
      Taro.login({
        success: async (res) => {
          if (res.code) {
            const integralForm = {
              sellerId: bindSellerId,
              code: res.code,
              name: detail.name
            }
            await http.post(LIMIT_FROM_SELLER_SINCE, integralForm);
          }
        }
      })
    }
    const good = detail
    const {notice, description} = detail
    good['notice'] = ""
    good['description'] = ""
    const checkmeal = []
    if (!good.meal_valid_type) {
      if (good.meals && good.meals.length > 0) {
        good.meals.map(item => {
          checkmeal.push(item)
        })
      }
    } else if (good.meal_valid_type == 2) {
      if (good.meals && good.meals.length > 0) {
        good.meals.map(item => {
          checkmeal.push(item)
        })
      }
    }
    const refundLabels = [];
    const tempArr = good.refund_sign ? good.refund_sign.split(",") : [];
    tempArr.map(item => {
      if(!!item) refundLabels.push(item);
    })
    await this.initData(detail, notice, description)
    if (process.env.TARO_ENV === 'tt') {
      good.b_scanning = []
    }
    await this.setState({
      good,
      checkmeal,
      platformSet,
      bindSellerId,
      showLoading: false,
      refundLabels
    })
  }

  shouldComponentUpdate(_nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean {
    return !!nextState.good;
  }

  async componentWillUnmount() {
    const {good} = this.state
    await this.setStateSync({good, isOpened: false, popInfo: false})
    clearInterval(this.clearTimeOutGetInfoId)
  }

  navigationBarTitle = ''

  async componentDidShow() {
    const platformSet = platform.info
    this.navigationBarTitle = process.env.P_ENV === 'lx' ? '商品详情' : platformSet.platformName
    await Taro.setNavigationBarTitle({
      title: this.navigationBarTitle
    })
    if (TARO_ENV === 'h5') {
      await h5Wx.getConfig()
    }
    clearInterval(this.clearTimeOutGetInfoId)
    const isLogin = await user.checkLogin();
    let tempSellerIdParams = ''
    let id = ''
    let bindSellerId = Taro.getStorageSync('bindSellerId') || 0;
    let tempSellerId = getTempSellerId(this)
    const scene = Taro.getCurrentInstance().router.params.scene as string | undefined;
    if (scene && (/^\d+_\d+_\d+$/.test(scene) || /^\d+_\d+_\d+_\d+$/.test(scene))) {
      const paramArr = scene.split('_'); // [ itemId, sellerId, bindSellerId, sid ] 长度不固定
      if (paramArr[3]) {
        tempSellerIdParams = tempSellerId = paramArr[3]
        setTempSellerId(tempSellerId)
      }
      id = paramArr[0]
    }
    this.setState({tempSellerId, isLogin, memberAdvertisement: await getMemberAdvertisement({ position: 'xiangqing' })})
    if (platformSet.isSellerPermanentLock) {
      if (!bindSellerId) {
        bindSellerId = Taro.getCurrentInstance().router.params.bindSellerId || bindSellerId;
      }
    } else {
      bindSellerId = Taro.getCurrentInstance().router.params.bindSellerId || bindSellerId;
    }
    user.bindSellerId = bindSellerId
    Taro.setStorage({
      key: 'bindSellerId',
      data: user.bindSellerId,
    })
    if (platform.subscription.show_place.indexOf("2") > -1) {
      this.setState({
        openMp: platform.subscription
      })
    }
    if (this.state.itemId) {
      const detail = await this.getDetailData(this.state.itemId, this.state.bindSellerId);
      if (detail) {
        const good = detail
        const {notice, description} = detail
        good['notice'] = ""
        good['description'] = ""
        const checkmeal = []
        if ((!good.meal_valid_type || good.meal_valid_type == 2) && good.meals && good.meals.length > 0) {
          good.meals.map(item => {
            checkmeal.push(item)
          })
        }
        this.setState({good, checkmeal}, () => {
          this.initData(detail, notice, description)
        })
      }
    }
    this.shareParams = await user.getSellerParams(tempSellerId)
    this.setState({bindSellerId})
    handlerRichImage()
    let isUser = true
    let isShowShareButton = false
    let identityIsSeller
    if (process.env.DISTINGUISH_IDENTITY) {
      identityIsSeller = await http.get(IDENTITY_IS_SELLER, {})
      isUser = !identityIsSeller.isSeller
    }
    if (process.env.SHOW_SHARE_POSTER) {
      isShowShareButton = identityIsSeller.isShowShareButton
    }
    if ((tempSellerIdParams || Taro.getCurrentInstance().router.params.tempSellerId) && isLogin && isUser && process.env.DISTINGUISH_IDENTITY) {
      const params = {
        category: 0,
        main_id: id,
        share_seller_id: tempSellerIdParams || tempSellerId
      }
      http.get(SHARE_USER_SHARE_INFO, params)
    }
    this.setState({isUser, isShowShareButton})
  }

  handlerPreviewImage(urls, current){
    Taro.previewImage({
      urls,
      current
    })
  }

  setStateSync(state) {
    return new Promise(resolve => {
      this.setState(state, resolve);
    });
  }

  shareParams = ''
  clearTimeOutGetInfoId
  count = 0

  makePhone(value) {
    try {
      const isH5 = TARO_ENV === 'h5'
      if (isH5 && isPc()) {
        Taro.showModal({
          title: '商家电话',
          content: value,
        })
        return false
      }
      Taro.makePhoneCall({
        phoneNumber: value
      })
    } catch (e) {
      Taro.showToast({title: '拨打电话失败', icon: 'none'})
    }
  }

  async initSupplierStore() {
    const res = await http.HPost(SUPPLIER_STORE_LIST, {goods_id: this.state.upDataDetail.id, category: 0})
    if (res) {
      this.setState({
        supplierStoreList: res.data.list
      })
    }
  }

  async componentDidHide() {
    clearInterval(this.clearTimeOutGetInfoId)
    this.setState({popInfo: false})
  }

  tabsClick(value = 0) {
    const tabs = this.state.tabs;
    const select = tabs[value];
    this.setState({currentIndex: value, currentFlag: true});
    const timer = setTimeout(() => {
      clearTimeout(timer);
      this.setState({currentFlag: false});
    }, 1000);
    if (process.env.TARO_ENV === 'weapp' || process.env.TARO_ENV === 'tt') {
      const query = Taro.createSelectorQuery();
      query.selectViewport().scrollOffset();
      switch (select.name) {
        case 'meal':
          query.select('#meal').boundingClientRect();
          break;
        case 'recommend':
          query.select('#recommend').boundingClientRect();
          break;
        case 'notice':
          query.select('#notice').boundingClientRect();
          break;
        case 'desp':
          query.select('#description').boundingClientRect();
          break;
        case 'evaluation':
          query.select('#evaluation').boundingClientRect();
          break;
        default:
          break;
      }
      query.exec(res => {
        Taro.pageScrollTo({
          duration: 300,
          scrollTop: res[0].scrollTop + res[1].top - (process.env.TARO_ENV === 'tt' ? 50 : 141)
        })
      })
    } else {
      const a = document.getElementsByClassName('ScrollTo')
      if (a[value]) {
        Taro.pageScrollTo({
          duration: 300,
          scrollTop: a[value].offsetTop - 54
        })
      }
    }
  }

  onPageScroll() {
    const {recommendGood, evaluationList, good, currentIndex, currentFlag} = this.state;
    const {mealIndex, descIndex, noticeIndex, evaluationIndex, recommendIndex, topHeight} = this;
    const query = Taro.createSelectorQuery();
    if (good.meal_details) {
      query.select('#meal').boundingClientRect();
    }
    if (process.env.P_ENV === 'kd') {
      query.select('#description').boundingClientRect();
      query.select('#notice').boundingClientRect();
    } else {
      query.select('#notice').boundingClientRect();
      query.select('#description').boundingClientRect();
    }
    let index = 0;
    evaluationList && evaluationList.length > 0 && query.select('#evaluation').boundingClientRect();
    recommendGood && recommendGood.length > 0 && query.select('#recommend').boundingClientRect();
    query.exec(res => {
      if (good.meal_details && res[mealIndex] && res[mealIndex].top < topHeight) { // 套餐
        index = mealIndex
      }
      if (process.env.P_ENV === 'kd') {
        if (res[descIndex] && res[descIndex].top < topHeight) { // 图文介绍
          index = descIndex
        }
        if (res[noticeIndex] && res[noticeIndex].top < topHeight) { // 购买须知
          index = noticeIndex
        }
      } else {
        if (res[noticeIndex] && res[noticeIndex].top < topHeight) { // 购买须知
          index = noticeIndex
        }
        if (res[descIndex] && res[descIndex].top < topHeight) { // 图文介绍
          index = descIndex
        }
      }
      if (evaluationList && evaluationList.length > 0 && res[evaluationIndex] && res[evaluationIndex].top < topHeight) { // 评价
        index = evaluationIndex
      }
      if (recommendGood && recommendGood.length > 0 && res[recommendIndex] && res[recommendIndex].top < topHeight) { // 猜你喜欢
        index = recommendIndex
      }
      if (index !== currentIndex && currentFlag) {
        this.setState({tabIndex: currentIndex});
      } else {
        this.setState({tabIndex: index});
      }
    })
  }

  async initData(detail, notices = '', description = '') {
    const isKd = process.env.P_ENV === 'kd'
    const isLogin = await user.checkLogin();
    const {limitGoodsId, goodsDiscountCodeType, goodsDiscountCodeId} = this.state
    this.getIsFavoriteStatus(detail.uuid)
    if (detail.sell_begin) {
      const now = new Date().getTime()
      if (now < detail.sell_begin) {
        this.setState({notOpen: true})
      }
    }
    const itemName = isKd ? (detail.sub_title || detail.name || '') : (detail.name || detail.sub_title || '')
    this.setState({
      isLogin,
      siteServiceWx: detail.siteServiceWx || '',
      sitePhone: detail.siteServiceTelephone || '',
      itemId: detail.uuid,
      itemName,
      showLoading: false,
      popInfo: false
    })
    if (detail.is_open_purchase_information && this.count === 0 && detail.purchase_information) {
      ++this.count
      this.setState({isOpened: true})
    }
    if (detail.share_data_flag) {
      this.setState({
        sloganList: detail.share_data_json.shareInfoArr ? detail.share_data_json.shareInfoArr.slogan_list : [],
        power: detail.share_data_flag,
        userPower: detail.share_data_json.power,
        shareSetting: detail.share_data_json.shareInfoArr ? detail.share_data_json.shareInfoArr.img_list : []
      })
    }
    const oneMinute = lastMinute(detail.sell_end || 0)
    let bindSellerId = Taro.getCurrentInstance().router.params.bindSellerId || ''
    let tempSellerId = Taro.getCurrentInstance().router.params.tempSellerId || ''
    const scene = Taro.getCurrentInstance().router.params.scene || ''
    if (scene && (/^\d+_\d+_\d+$/.test(scene) || /^\d+_\d+_\d+_\d+$/.test(scene))) {
      const paramArr = scene.split('_');
      if (paramArr[2]) {
        bindSellerId = paramArr[2]
      }
      if (paramArr[3]) {
        tempSellerId = paramArr[3]
      }
    }
    const upDataDetail = (await newHttp.catchGet<UpDataDetail>(NEW_GOOD_DETAIL_ON, {
      refer_seller_id: bindSellerId,
      temp_seller_id: tempSellerId,
      is_volume_series: Taro.getCurrentInstance().router.params.is_volume_series || '',
      uuid: detail.uuid,
      limit_goods_id: limitGoodsId,
      goodsDiscountCodeType,
      goodsDiscountCodeId
    })) || [];
    if (upDataDetail) {
      if (process.env.P_ENV === 'hiyogo' || process.env.P_ENV === 'vc') {
        const goodstext = upDataDetail.goodstext ? upDataDetail.goodstext : '可用时间'
        this.setState({ goodstext });
      }
    }
    if (!upDataDetail.isSeller && detail.share_data_flag && !detail.share_data_json.power.includes('2')) {
      this.setState({
        power: false
      })
    }
    const goodStatus = status[upDataDetail.status || 1]
    this.setState({
        otherGood: detail.otherGood || [],
        notices,
        description,
        upDataDetail,
        is_subscribe: upDataDetail.is_subscribe || 0,
        goodStatus,
        btnDisabled: true,
        oneMinute
      }, async () => {
        this.initSupplierStore()
      }
    )
    if ((bindSellerId || tempSellerId) && isLogin && process.env.DISTINGUISH_IDENTITY) {
      http.HPost(SCAN_BIND_SELLER, {temp_seller_id: tempSellerId, refer_seller_id: bindSellerId});
    }
    let evaluationList: any = []
    const tabs = [{title: '介绍', name: 'desp'}];
    if (process.env.P_ENV !== 'kd') {
      tabs.unshift({title: '须知', name: 'notice'})
    } else {
      tabs.push({title: '须知', name: 'notice'})
    }
    if (platform.info.application_open_comment && process.env.TARO_ENV !== 'tt') {
      evaluationList = await http.HPost(GOODS_EVALUATION_APP_LIST, {
        page: 1,
        length: 3,
        k: '',
        search_product_no: detail.no,
        search_main_type: 0,
        search_product_id: detail.id
      })
      if (evaluationList && evaluationList.data && evaluationList.data.length > 0) {
        tabs.push({title: '评价', name: 'evaluation'})
        this.setState({evaluationList: evaluationList.data, recordsTotal: evaluationList.recordsTotal})
      }
    }
    const recommendGood: any = []
    const result = await fetchNewGoodsList.getGoodsList({
      module_type: "2",
      page: 1,
      length: 10,
      data_type: 1,
      uuid: detail.uuid
    });
    for (let i = 0, len = result.length; i < len; i++) {
      const obj = {
        ...result[i],
        commission_price: result[i].commission || "",
        salesVolume: result[i].sales_volume,
      }
      recommendGood.push(obj);
    }
    const reserveGoodsRet = await http.get<ReserveGoods[]>(LIMIT_APPOINTMENT, {uuid: detail.uuid});
    if (recommendGood && recommendGood.length > 0 && platform.info.application_open_comment) {
      tabs.push({title: '推荐', name: 'recommend'})
    }
    let sharePoster
    if (detail.images[0] && detail.images[0].url) {
      sharePoster = await getSharePoster({
        uuid: detail.uuid,
        imgUrl: detail.images[0] && detail.images[0].url,
        price: detail.price || 0,
        market_price: detail.market_price || 0,
        isDetail: 'limited'
      });
    }
    if (detail.meal_details) {
      tabs.unshift({title: '套餐', name: 'meal'})
    }
    for (let i = 0; i < tabs.length; i++) {
      if (tabs[i].name === 'meal') {
        this.mealIndex = i
      }
      if (tabs[i].name === 'desp') {
        this.descIndex = i
      }
      if (tabs[i].name === 'notice') {
        this.noticeIndex = i
      }
      if (tabs[i].name === 'evaluation') {
        this.evaluationIndex = i
      }
      if (tabs[i].name === 'recommend') {
        this.recommendIndex = i
      }
    }
    this.topHeight = TARO_ENV === 'h5' ? 56 : 142
    this.setState({
      sharePoster,
      recommendGood,
      tabs,
      reserveGoods: reserveGoodsRet || []
    });
    if (process.env.TARO_ENV === 'h5') {
      const shareParams = await user.getSellerParams(this.state.tempSellerId)
      const shareData = {
        category: 0,
        isProduct: true,
        uuid: detail.uuid,
        title: itemName,
        desc: detail.goods_lightspot || detail.slogan || '',
        link: window.location.origin + '/common/limited/detail?itemId=' + detail.uuid + '&' + shareParams,
        imgUrl: process.env.P_ENV === 'kd' ? detail.img : (sharePoster.url || detail.img)
      }
      await h5Wx.share(shareData)
    }
    http.get(SITE_INFO, {uuid: detail.uuid || ''}).then(res => {
      this.setState({
        siteInfo: res
      })
    });
    if (isLogin && detail.is_pub && !(goodStatus === -1 || goodStatus === 99 || goodStatus === 0) && platform.info.application_open_bubble) {
      this.clearTimeOutGetInfoId = setInterval(async () => {
        const popInfo = await http.HPost(BUBBLE_GET_INFO, {})
        this.setState({popInfo: popInfo.data})
      }, 5000)
    }
  }

  mealIndex = 0
  descIndex = 0
  noticeIndex = 0
  evaluationIndex = 0
  recommendIndex = 0
  topHeight = 0

  async getDetailData(id = '', bindSellerId = 0, isId = false) {
    if (id) {
      let data: any = {uuid: id, referSellerId: bindSellerId}
      if (isId) {
        data = {id, referSellerId: bindSellerId}
      }
      if (TARO_ENV === 'h5') {
        data.longUrl = await getLongUrl()
      }
      const detail = await newHttp.catchGet(NEW_GOOD_DETAIL, data);
      let res: any = {data: false}
      let wxres: any = {data: false}
      if ((await user.checkLogin()) && process.env.IS_SHOW_LIVING_CODE) {
        wxres = await http.HGet(CONTENT_QRWX, {id, goods_id: detail.id});
        res = await http.HGet(CONTENT_QR, {id, goods_id: detail.id, goods_type: 0});
      }
      const siteId = Taro.getCurrentInstance().router.params.siteId;
      if (siteId && process.env.IS_SHOW_LIVING_CODE) {
        res = await http.HGet(CONTENT_QR, {id, sid: siteId, goods_id: detail.id, goods_type: 0});
      }
      if (res.data) {
        this.setState({qrImg: res.data.code, qrImgDescribe: res.data.code_describe})
      }
      this.setState({bindSellerId, wxQrImg: wxres.data})
      const groupBuyId = Taro.getCurrentInstance().router.params.groupBuyId;
      if (groupBuyId) {
        data.group_buy_id = groupBuyId
      }
      if (detail.b_scanning) {
        detail.b_scanning = detail.b_scanning.split(',')
      }
      if (!this.state.orderNum && process.env.IS_SHOW_GROUP_ACTIVITY) {
        const groupDetail = await newHttp.catchGet(QGODUCT_GROUP_ACTIVITY_INFO, data);
        if (JSON.stringify(groupDetail) !== '{}') {
          if (groupDetail.data && JSON.stringify(groupDetail.data) !== '{}') {
            this.setState({groupDetail: groupDetail.data})
          }
        }
      }
      if (detail) {
        return detail
      } else {
        setTimeout(() => {
          Taro.switchTab({url: '/pages/index/index'})
        }, 2000)
        return false
      }
    } else {
      return false
    }
  }

  onShareAppMessage() {
    if (process.env.TARO_ENV !== 'tt') {
      http.post(UPDATE_USER_SHARE_DATE, {})
    }
    const {itemName, itemId, good, sharePoster, isUser, upDataDetail} = this.state
    const category = 0
    if (!isUser && process.env.TARO_ENV !== 'tt') {
      http.get(SHARE_SHARE_INFO, {category, main_uuid: itemId})
    }
    http.get(ADD_SHARE_VOLUME, {category, uuid: itemId})
    return {
      path: '/common/limited/detail?itemId=' + this.state.itemId + '&' + this.shareParams + `&sKey=${Taro.getStorageSync('sKey' || '')}`,
      title: itemName,
      imageUrl: process.env.P_ENV === 'kd' ? good.url : (sharePoster.url || good.url),
      extra: {
        spu_id: upDataDetail.bd_spu_id
      }
    };
  }

  onShareTimeline() {
    if (process.env.TARO_ENV !== 'tt') {
      http.post(UPDATE_USER_SHARE_DATE, {})
    }
    const {itemName, itemId, good, sharePoster, isUser, upDataDetail} = this.state
    const category = 0
    if (!isUser && process.env.TARO_ENV !== 'tt') {
      http.get(SHARE_SHARE_INFO, {category, main_uuid: itemId})
    }
    http.get(ADD_SHARE_VOLUME, {category, uuid: itemId})
    user.checkLogin().then(isLogin => {
      if (isLogin) {
        http.HPost(ROOKIEGUID_TASK_RECORD, {remark: "朋友圈"})
      }
    })
    return {
      title: itemName,
      imageUrl: process.env.P_ENV === 'kd' ? good.url : (sharePoster.url || good.url),
      query: 'itemId=' + itemId + '&' + this.shareParams + `&sKey=${Taro.getStorageSync('sKey' || '')}`,
      extra: {
        spu_id: upDataDetail.bd_spu_id
      }
    }
  }

  async navigate(address: string) {
    if (this.state.platformSet.isHideNavigation == 1) {
      return false;
    }
    Taro.showLoading({title: '导航中...'})
    const ret = await location.getCoordinate(address)
    Taro.hideLoading()
    if (ret) {
      lxH5Wx.navigation(ret.lat, ret.lng, address)
    } else {
      Taro.showToast({title: '导航失败,请检查地址信息,请检测地址', icon: 'none'})
    }
  }

  posterRef = React.createRef<any>();

  async getPoste() {
    try {
      Taro.showLoading({title: '加载中...'})
      const {isLogin, pkeys} = this.state
      if (!isLogin && !pkeys) {
        const timer = setTimeout(() => {
          clearTimeout(timer)
          user.jumpLogin()
          Taro.hideLoading()
        }, 500);
        return
      }
      let userIdentity = false
      if (isLogin) {
        userIdentity = await http.get(IDENTITY, {})
        if (userIdentity && userIdentity.sellerStatus && userIdentity.sellerStatus === 3) {
          return Taro.navigateTo({url: '/common/distributor/invite/group'})
        }
      }
      this.posterRef.current && this.posterRef.current.show();
      if (userIdentity && userIdentity.isSeller) {
        await http.get(SHARE_SHARE_INFO, {category: 0, main_uuid: this.state.good.uuid})
      }
      Taro.hideLoading()
    } catch (e) {
      Taro.hideLoading()
    }
  }

  async onGetPoster() {
    //先判断用户是否存在
    const isSeller = !this.state.isUser;
    const {good, tempSellerId, pkeys, itemId} = this.state
    const sKey = Taro.getStorageSync('sKey')
    if (isSeller || pkeys || process.env.P_ENV !== 'kd' || sKey === '5f9785ef-b81b-46c2-90e0-598e91d6c4b9' || sKey === '66e7da6efc014cd2be9ccd1b34530562' || sKey === '3b16d77f556f494db82a3c20d7178ad5' || sKey === '55ad98a1596040688e170e70fe862868') {
      Taro.showLoading({title: '获取海报中...'});
      const poster = await getPoster('limit', good.uuid || '', '', tempSellerId)
      if (poster) {
        if (!pkeys) {
          if (isSeller) {
            await http.get(SHARE_SHARE_INFO, {category: 0, main_uuid: good.uuid})
          }
          http.get(ADD_SHARE_VOLUME, {category: 0, uuid: itemId})
        }
        Taro.navigateTo({url: '/distributor/poster/poster?url=' + poster.url})
      } else {
        Taro.showToast({title: '获取海报失败！', icon: 'none'})
      }
    } else {
      Taro.navigateTo({url: '/common/distributor/invite/join'})
    }
    Taro.hideLoading();
  }

  async navigateOut(latitude, longitude) {
    lxH5Wx.navigation(latitude, longitude)
  }

  async changeGood(uuid) {
    Taro.showLoading({title: '加载中...'});
    const detail = await this.getDetailData(uuid, this.state.bindSellerId);
    if (detail) {
      const good = detail
      const {notice, description} = detail
      good['notice'] = ""
      good['description'] = ""
      const checkmeal = []
      if (!good.meal_valid_type) {
        if (good.meals && good.meals.length > 0) {
          good.meals.map(item => {
            checkmeal.push(item)
          })
        }
      } else if (good.meal_valid_type == 2) {
        if (good.meals && good.meals.length > 0) {
          good.meals.map(item => {
            checkmeal.push(item)
          })
        }
      }
      this.setState({good, checkmeal}, () => {
        this.initData(good, notice, description);
      })
    }
    Taro.hideLoading();
  }

  async showAppointmentHandle(uuid = '') {
    Taro.showLoading({title: '加载数据中...'});
    const ret = await http.get<{ date: string; price: number; stock_balance: number }[]>(LIMIT_LIST_APPOINTMENT, {goodsUuid: uuid})
    if (ret && ret.length > 0) {
      this.setState({
        calendarArr: ret.map(item => {
          if (item.stock_balance > 0) {
            return {surplusStock: item.surplus_stock, value: item.date, price: item.price || 0}
          } else {
            return {surplusStock: item.surplus_stock, value: false, price: item.price || 0}
          }
        })
      })
    }
    this.setState({showCalendar: true})
    Taro.hideLoading();

  }

  getMSG() {
    this.setState({
      is_subscribe: 1
    })
  }

  async removeMSG() {
    const {good} = this.state
    const that = this
    const uuid = good.uuid
    const ret = await http.postCar(OFF_USER_SALE_SUB, {goodsUUID: uuid})
    if (ret == '取消成功') {
      that.setState({is_subscribe: 0})
    } else {
      Taro.showToast({title: '取消失败', icon: 'none'})
    }
  }

  handleClickGroup() {
    if (this.checkJump()) {
      const openGroup = this.state.openGroup
      this.setState({
        openGroup: !openGroup
      })
    }
  }

  inOneMinute() {
    this.setState({
      oneMinute: true,
      goodStatus: 1
    })
  }

  checkMeal(index) {
    const {good, checkmeal} = this.state
    if (good.meal_valid_type) {
      if (good.meal_valid_num === 1) {
        good.meals[index].check = !good.meals[index].check;
        let i = 0
        for (const item of good.meals) {
          if (i !== index) {
            good.meals[i].check = false
          }
          i++
        }
      } else {
        if (!good.meals[index].check) {
          if (good.meal_valid_num > checkmeal.length) {
            good.meals[index].check = true
          }
        } else {
          good.meals[index].check = false
        }
      }
      const meals = []
      good.meals.map(item => {
        if (item.check) {
          meals.push(item)
        }
      })
      this.setState({
        good, checkmeal: meals
      })
    }
  }

  goPey() {
    const {good, isLogin, checkmeal, upDataDetail} = this.state
    const gooddata = {}
    gooddata['img'] = good.images[0].url
    gooddata['name'] = good.name
    gooddata['price'] = good.price
    gooddata['images'] = good.images
    Taro.setStorage({
      key: "placeOrder",
      data: JSON.stringify(gooddata),
      success: async function () {
        if (!isLogin) {
          user.jumpLogin()
        } else {
          if (good.meal_valid_type && checkmeal.length < good.meal_valid_num) {
            Taro.showToast({title: `您还需选${good.meal_valid_num - checkmeal.length}个套餐`, icon: 'none', duration: 2000})
          } else {
            const mealArrId = []
            checkmeal.map(item => {
              mealArrId.push(item.id)
            })
            Taro.setStorageSync("checkmeal", checkmeal)
            if (good.isSelf) {
              Taro.navigateTo({url: '/main/order/place?itemId=' + good.id + '&m=limited'})
            } else {
              Taro.navigateTo({url: '/main/order/confirm?itemId=' + good.id + '&m=limited&meal=' + mealArrId.join(",") + '&zero=' + upDataDetail.can_zero_buy})
            }
          }
        }
      }
    })
  }

  toggleMeals(showNum) {
    const {good} = this.state
    if (showNum == 3) {
      this.setState({showNum: good.meals.length})
    } else {
      this.setState({showNum: 3})
    }
  }

  gotoShopList() {
    Taro.navigateTo({url: '/common/limited/list?goodsId=' + this.state.upDataDetail.id})
  }

  async onOpenModel() {
    if (!(await user.checkLogin())) {
      // return user.jumpLogin()
    }
    this.setState({modalShow: true})
  }

  async handleCancel() {
    this.setState({modalShow: false})
  }

  handleClose() {
    this.setState({modalShow: false})
  }

  async onWXOpenModel() {
    this.setState({wxModalShow: true})
  }

  async wxhandleCancel() {
    this.setState({wxModalShow: false})
  }

  async onTimeUp() {
    if (this.state.itemId) {
      const detail = await this.getDetailData(this.state.itemId, this.state.bindSellerId);
      if (detail) {
        const good = detail
        const {notice, description} = detail
        good['notice'] = ""
        good['description'] = ""
        const checkmeal = []
        if (!good.meal_valid_type) {
          if (good.meals && good.meals.length > 0) {
            good.meals.map(item => {
              checkmeal.push(item)
            })
          }
        } else if (good.meal_valid_type == 2) {
          if (good.meals && good.meals.length > 0) {
            good.meals.map(item => {
              checkmeal.push(item)
            })
          }
        }
        this.setState({good, checkmeal}, () => {
          this.initData(detail, notice, description)
        })
      }
    }
  }

  getParams() {
    return `force_platform_seller=${this.state.force_platform_seller}&`
  }

  checkJump() {
    if (this.state.pkeys) {
      Taro.showToast({title: 'pc端此功能只做模拟，具体请前往移动端体验！', duration: 3500, icon: 'none'})
      return false
    }
    return true
  }

  async getIsFavoriteStatus(uuid) {
    const data = await newHttp.catchGet('/msvc-shop/v1/goods/hotel/isFavorite', {uuid: uuid, branch: 0})
    if(data) {
      this.setState({
        is_favorite: data.is_favorite
      })
    }
  }
  async collection(type) {
    const data = await handlerCollection(type, 0, this.state.good.id)
    if (data != false) {
      this.setState({
        is_favorite: type === 0 ? 1 : 0
      })
      await Taro.showToast({
        mask: true,
        icon: 'none',
        title: `${type === 0 ? '添加收藏成功！' : '取消收藏成功！'}`,
        image: TARO_ENV === 'h5' ? 'https://resource.ivcheng.com/upload/2022/08/19/1455aeb277d349efbe926662366b126b.png' : ''
      })
    }
  }

  render() {
    const dataColor = Taro.getStorageSync('colorData');
    const {
      bdInfo,
      goodstext,
      is_favorite,
      memberAdvertisement,
      isShowShareButton,
      is_subscribe,
      isUser,
      pkeys,
      notOpen,
      popInfo,
      groupBuyId,
      groupDetail,
      minHeight,
      isOpened,
      power,
      sloganList,
      userPower,
      shareSetting,
      orderNum,
      tempSellerId,
      showCalendar,
      good,
      siteInfo,
      tabIndex,
      tabs,
      recommendGood,
      sitePhone,
      siteServiceWx,
      floatLayout,
      notice,
      showLoading,
      goodStatus,
      btnDisabled,
      isLogin,
      otherGood,
      reserveGoods,
      showAppointment,
      calendarArr,
      platformSet,
      height,
      openGroup,
      oneMinute,
      upDataDetail,
      description,
      notices,
      checkmeal,
      openMp,
      showNum,
      recordsTotal,
      evaluationList,
      supplierStoreList,
      modalShow,
      qrImg,
      qrImgDescribe,
      searchBarTop,
      wxModalShow,
      wxQrImg,
      refundLabels
    } = this.state;
    return (
      <View className='limitedDetailRoot prodRoot'>
        {TARO_ENV !== 'h5' && TARO_ENV !== 'tt' && !showLoading && <View className='head-bg' style={`height: ${searchBarTop}Px;`}>
          <Headercar color='black' isLogin={isLogin} showShare={Boolean(true)} title={this.navigationBarTitle}
            tabColor='#000'
            showMenu={false} backgroundColor='#fff' bcolor='transparent'
          />
        </View>}
        <GzhAuth />
        <Skeleton loading={showLoading}
          title
          titleWidth='100%' rowHeight='275px'
        >
          <View className='swiper-box-wrapper'>
            {good && <View className='swiper-box'>
              <DetailHeader pkeys={pkeys} height={height} videoId={good.qq_video_id || ''} mp3={good.mp3 || ''}
                imagesList={(good && good.images.map(item => item.url)) || []}
              />
              {(process.env.P_ENV === 'vc' || process.env.P_ENV === 'kunxin') && is_favorite == 0 && <View className={`at-icon at-icon-star iconClass ${TARO_ENV === 'h5' ? '' : 'iconClass-weapp'}`} onClick={() => this.collection(0)}></View>}
              {(process.env.P_ENV === 'vc' || process.env.P_ENV === 'kunxin') && is_favorite == 1 && <View className={`at-icon at-icon-star-2 iconClass iconClass-add ${TARO_ENV === 'h5' ? '' : 'iconClass-weapp'}`} onClick={() => this.collection(1)}>
              </View>}
            </View>}
          </View>
        </Skeleton>
        {!showLoading && groupDetail && !!good.surplus_stock &&
        <View className='group-wrapper' style={`background-color: ${dataColor.priceColor}`}>
          <View className='group-wrapper-left'>
            <View className='group-wrapper-left-info'>
              <View className='group-wrapper-left-info-detail'>
                <Text className='symbol'>￥</Text><Text
                  className='true-price'
                >{!!groupDetail.discounts_price ? groupDetail.discounts_price : groupDetail.group_price}</Text><Text
                  className='qi'
                >起</Text>
                <View className='discount-price' style='color: #fff;'>
                  <Text style='color: #fff;'>￥</Text>
                  <Text style='color: #fff;'>{groupDetail.goods_price}</Text>
                  <View className='line' style='background: #fff;' />
                </View>
                <View className='group-label'
                  style='color: #f73c01;'
                ><Text
                  className='group-label-content'
                >{groupDetail.activity_type === 2 ? '人多更优惠' : groupDetail.people_num + '人拼团价'}</Text></View>
              </View>
            </View>
          </View>
          <View className='group-wrapper-right'>
            <View className='count-down-box group-detail'>
              {groupDetail && groupDetail.start_status === '未开始' && groupDetail.activity_date_poor &&
              <View className='count-down-wrap'>
                <View className='time-tips'>距开始仅剩</View>
                <AtCountdown
                  onTimeUp={this.onTimeUp.bind(this)}
                  isCard
                  isShowDay
                  format={{day: '天', hours: ':', minutes: ':', seconds: ''}}
                  minutes={groupDetail.activity_date_poor.min}
                  seconds={0}
                  day={groupDetail.activity_date_poor.day}
                  hours={groupDetail.activity_date_poor.hour}
                />
              </View>}
              {groupDetail && groupDetail.start_status === '进行中' && groupDetail.activity_date_poor &&
              <View className='count-down-wrap'>
                <View className='time-tips'>距结束仅剩</View>
                <AtCountdown
                  onTimeUp={this.onTimeUp.bind(this)}
                  isCard
                  isShowDay
                  format={{day: '天', hours: ':', minutes: ':', seconds: ''}}
                  minutes={groupDetail.activity_date_poor.min}
                  seconds={0}
                  day={groupDetail.activity_date_poor.day}
                  hours={groupDetail.activity_date_poor.hour}
                />
              </View>}
            </View>
          </View>
        </View>}
        <View className='limit-header-raduis'>
          {/* 20221015备注: 非下架的限时抢购默认展示价格。已下架的商品不展示 */}
          <ProductName
            goodsLen={1}
            shareVolume={good.share_volume} salesVolume={upDataDetail.salesVolume}
            surplusStock={upDataDetail.surplus_stock} virtualStore={good.virtual_store}
            actualVirtualStore={good.actual_virtual_store} price={good.price} groupDetail={groupDetail}
            inOneMinute={this.inOneMinute.bind(this)} goodStatus={goodStatus} goods={good}
            time={goodStatus === 0 ? (good.sell_begin || 0) : (good.sell_end || 0)}
            upDataDetail={upDataDetail} isLogin={isLogin} name={good.name || ''}
            category={good.category || (goodStatus === 0 || goodStatus === 1) ? 5 : 0} goodsId={good.id}
            goodsLightspot={good.goods_lightspot} subTitle={good.sub_title} loading={showLoading}
            labels={good.serviceLabels || []} type='limited'
            refundLabels={refundLabels}
          />
          <Skeleton loading={showLoading} row={4} rowHeight={80}>
            <Block>
              {(process.env.P_ENV === 'vc' || process.env.P_ENV === 'kunxin') && !!platformSet && !!platformSet.applicationOpenVip && memberAdvertisement &&
              <View style='margin-top: 10px;'>
                <AdvertisementMember url={memberAdvertisement} />
              </View>}
            </Block>
          </Skeleton>
        </View>
        <Skeleton title row={3} loading={showLoading}>
          <Block>
            {process.env.TARO_ENV !== 'tt' && !!good.open_meal && good.meals && good.meals.length > 0 && <View className='meals-good other-good'>
              <View className='Mtitle'><View className='content-header'><View className='line'
                style={`background-color: ${process.env.mainColor}`}
              /><View
                className='title'
              >套餐包含</View></View>
                {good.meal_valid_type && good.meal_valid_type == 1 ?
                  <Block>
                    <View className='other-good-more'
                      onClick={this.handleClickGroup.bind(this)}
                    >{good.meal_valid_num ? `共需选${good.meal_valid_num}个` : ''}<Text
                      style={`background: ${dataColor.gradientColor}`}
                    >选择</Text></View>
                  </Block>
                  :
                  <Block>
                    <View
                      className='other-good-more'
                    >{!good.meal_valid_type ? '' : `最多使用${good.meal_valid_num}个`}</View>
                  </Block>
                }
              </View>
              {good.meals.map((item, i) =>
                <Block>
                  {i < showNum && <View key={i} style='display:block' className='good-item'>
                    <View className='good-item-top'>
                      <View className='title'><View className='title-left-round'
                        style={`background-color: ${process.env.mainColor}`}
                      /> {item.productName}
                      </View>
                      <View className='price'>x{item.amount}</View>
                    </View>
                    {!!item.is_need_reserve && <View className='meal_time'>
                      <View className='label'
                        style={`border: 1Px solid ${dataColor.titleColor};color: ${dataColor.titleColor}`}
                      >需预约</View>
                      <View className='nums'>x{item.amount}</View>
                    </View>}
                  </View>}
                </Block>)}
              {good.meals.length > 3 &&
              <View className='good_meals_more' onClick={this.toggleMeals.bind(this, showNum)}>{showNum > 3 ?
                <Block>收起<AtIcon value='chevron-up' size='15' color='#eb5a15' /></Block> :
                <Block>查看更多<AtIcon value='chevron-down' size='15' color='#eb5a15' /></Block>}</View>}
            </View>}
          </Block>
        </Skeleton>
        {groupDetail && !showLoading && groupDetail.group_buy_list && groupDetail.group_buy_list.length > 0 &&
        <GroupIndex isJoin={groupDetail.is_join} initData={this.onTimeUp.bind(this)}
          goToGroup={async (stepNum, activityId, index) => {
                      if (this.checkJump()) {
                        const data = await http.HPost(ACTIVITY_CHECK, {group_buy_id: groupDetail['group_buy_list'][index].group_buy_id})
                        if (!data) {
                          return
                        }
                        const gooddata = {}
                        const goodId = good.id
                        const {goodUuid} = this.state
                        gooddata['img'] = good.images[0].url
                        gooddata['name'] = good.name
                        gooddata['price'] = good.price
                        gooddata['images'] = good.images
                        Taro.setStorage({
                          key: "placeOrder",
                          data: JSON.stringify(gooddata),
                          success: async () => {
                            if (!isLogin) {
                              user.jumpLogin()
                            } else {
                              if (good.isSelf) {
                                Taro.navigateTo({url: `/main/order/place?${this.getParams()}itemId=` + goodId + `&m=limited&activityId=${activityId}&isLeader=false&stepNum=${stepNum}&goodUuid=${goodUuid}&groupBuyId=${groupDetail['group_buy_list'][index].group_buy_id}`})
                              } else {
                                Taro.navigateTo({url: `/main/order/confirm?${this.getParams()}itemId=` + goodId + '&m=limited' + '&tempSellerId=' + tempSellerId + `&activityId=${activityId}&isLeader=false&stepNum=${stepNum}&goodUuid=${goodUuid}&groupBuyId=${groupDetail['group_buy_list'][index].group_buy_id}`})
                              }
                            }
                          }
                        })
                      }
                    }} groupDetail={groupDetail} nums={groupDetail.all_join_people_num}
          groupList={groupDetail.group_buy_list}
        />}
        <Skeleton row={5} loading={showLoading}>
          <Block>
            {otherGood && otherGood.length > 0 && <View className='other-good'>
              <View className='Mtitle'><View className='content-header'><View className='line'
                style={`background-color: ${process.env.mainColor}`}
              /><View
                className='title'
              >关联商品</View></View></View>
              {otherGood.map(item => <View key={item.id}
                className={`good-item ${good.uuid === item.uuid ? 'selected' : ''}`}
                style={`${good.uuid === item.uuid && `color: ${dataColor.priceColor};border-color:${dataColor.priceColor}`}`}
                onClick={this.changeGood.bind(this, item.uuid)}
              >
                <Text className='title'>{item.name}</Text>
                <Text className='price' style={`${good.uuid === item.uuid && `color: ${dataColor.priceColor}`}`}><Text
                  className='symbol'
                  style={`${good.uuid === item.uuid && `color: ${dataColor.priceColor}`}`}
                >¥</Text>{item.price}</Text>
              </View>)}
            </View>}
            {supplierStoreList && supplierStoreList.length > 0 && <SiteBox category={0} info={supplierStoreList} goodsId={upDataDetail.id} />}
            {process.env.TARO_ENV === 'tt' && upDataDetail.douyin_business_license && supplierStoreList.length <= 0 && <View className='good-info-box' style='background-color: #fff;padding: 0 5px;'>
              <View onClick={this.handlerPreviewImage.bind(this, [upDataDetail.douyin_business_license], upDataDetail.douyin_business_license)} className='good-info-item' style='justify-content: space-between'>
                <View>商家资质</View>
                <View><AtIcon value='chevron-right' size={16} color='#000' /></View>
              </View>
            </View>}
            <View className='good-info-box'>
              {good.latitude && good.longitude ?
                <View style='justify-content: space-between' className={`location ${(process.env.P_ENV === 'kunxin') ? 'kunxin-icon-location' : ''}`} onClick={this.navigateOut.bind(this, good.latitude, good.longitude)}>
                  <View className='info'><Text selectable>{good.location}{good.address}</Text></View>
                  {platformSet.isHideNavigation != 1 && process.env.P_ENV !== 'kunxin' &&
                  <Image className='img' src={RESOURCE_URL + "/upload/images/20210825/1629891614709_668.png"}
                    mode='aspectFill'
                  />}
                  {platformSet.isHideNavigation != 1 && process.env.P_ENV === 'kunxin' &&
                  <Image className='img' src='https://resource.ivcheng.com/upload/2022/11/04/d1b0aefaf44d4f65bb6fd4f7bf952fc3.png'
                    mode='aspectFill'
                  />}
                </View>
                :
                <Block>
                  {good.address &&
                  <View style='justify-content: space-between' className={`location ${(process.env.P_ENV === 'kunxin') ? 'kunxin-icon-location' : ''}`} onClick={this.navigate.bind(this, good.location + good.address)}>
                    <View className='info'><Text selectable>{good.location}{good.address}</Text></View>
                    {platformSet.isHideNavigation != 1  && process.env.P_ENV !== 'kunxin' &&
                    <Image className='img' src={RESOURCE_URL + "/upload/images/20210825/1629891614709_668.png"}
                      mode='aspectFill'
                    />}
                    {platformSet.isHideNavigation != 1 && process.env.P_ENV === 'kunxin' &&
                    <Image className='img' src='https://resource.ivcheng.com/upload/2022/11/04/d1b0aefaf44d4f65bb6fd4f7bf952fc3.png'
                      mode='aspectFill'
                    />}
                  </View>}
                </Block>
              }
              <GoodInfoBox type='limited' info={good} goodstext={goodstext} />
              {good.link_phone &&
              <View onClick={this.makePhone.bind(this, good.link_phone)}
                className={`good-info-item good-info-item-phone ${(process.env.P_ENV === 'kunxin') ? 'kunxin-icon-good-phone' : ''}`}
              ><View
                className='title'
              >联系电话：</View><View
                className={"text " + (showLoading ? "box-seat" : "")}
              ><Text selectable>{good.link_phone}</Text></View>{process.env.P_ENV === 'kunxin'&& <Image className='img' src='https://resource.ivcheng.com/upload/2022/11/04/f2e9e1d2d03a4bc4b7c132ab2c377107.png' mode='aspectFill'  />}
                </View>}
            </View>
            {!!reserveGoods && reserveGoods.length === 1 &&
            <View className='appointment'>
              {reserveGoods.map(item => <View className='appoint-item' key={item.uuid}
                onClick={this.showAppointmentHandle.bind(this, item.uuid)}
              >
                <View className='appoint-title'><AtIcon className='icon' prefixClass='car' value='iconriliyuyue'
                  size='16' color='#000'
                />
                  <Text className='earliest-available'>最早可约：</Text><Text
                    className='reserve-date'
                  >{item.earliest_date}</Text>
                </View>
                <View className='view-date'>查看日期<Text className='at-icon at-icon-chevron-right'
                  style='color:#000;margin-left:6rpx;'
                /></View>
              </View>)}
            </View>}
            {!!reserveGoods && reserveGoods.length > 1 && <View className='appointmentLenOverOne'>
              <View className='appointmentLenOverOneWrapper'>
                {reserveGoods.map((item, i) => <View className='appoint-item' key={item.uuid}
                  onClick={this.showAppointmentHandle.bind(this, item.uuid)}
                >
                  <View className={`goods-name-reserve-item ${!item.min_price && 'goods-name-reserve-item-inline'}`}>
                    <View className='goods-name-reserve-item-title'>{item.name}</View>
                    <View className='goods-name-reserve-item-price'>
                      {!!item.min_price && <View className='item-price'>
                        <Text className='symbol m-min-b' style={`color: ${dataColor.priceColor}`}>￥</Text>
                        <Text className='price m-min-b' style={`color: ${dataColor.priceColor}`}>{item.min_price}</Text>
                        <Text className='symbol' style={`color: ${dataColor.priceColor}`}>起</Text>
                      </View>}
                      <View style={`border: 1Px solid ${dataColor.titleColor};color: ${dataColor.titleColor}`}
                        className='item-view-date' onClick={this.showAppointmentHandle.bind(this, item.uuid)}
                      >
                        可约日期
                      </View>
                    </View>
                    {(!!item.min_price && i !== reserveGoods.length - 1) && <View className='line' />}
                  </View>
                </View>)}
              </View>
            </View>}
            {showCalendar && <Calendar dataInfo={calendarArr} onClose={() => {
              this.setState({showCalendar: false})
            }} type='range'
            />}
          </Block>
        </Skeleton>
        {/*{process.env.TARO_ENV === 'tt' && <JoinTtGroup platformSet={platformSet} />}*/}
        <View className='joinWx-enterStore'>
          {good.sid && process.env.TARO_ENV !== 'tt' && <JoinWx sid={good.sid} phone={sitePhone} />}
          {Object.keys(siteInfo).length != 0 && process.env.TARO_ENV !== 'tt' && <View className='joinWx-enterStore-line' />}
          {Object.keys(siteInfo).length != 0 && <EnterStore siteInfo={siteInfo} stars={siteInfo.star} />}
        </View>
        <View>
          <View className='tabs' style={`${TARO_ENV !== 'h5' && `top: ${searchBarTop}Px;`}`}>
            <View className='fixedTabs'>
              <AtTabs current={tabIndex} tabList={tabs} onClick={this.tabsClick.bind(this)} />
            </View>
          </View>

          {process.env.P_ENV !== 'kd' && <Block>
            {good.meal_details && <View className='detail-content ScrollTo no-top'>
              <View className='rich-content' id='meal'>
                <View className='content-header'>
                  <View className='line' style={`background-color: ${process.env.mainColor}`} />
                  <View className='title'>套餐包含</View>
                </View>
                {TARO_ENV === 'weapp' && <View className='content-info'>
                  <parser selectable html={good.meal_details || ''} />
                </View>}
                {TARO_ENV === 'tt' && <View className='content-info'>
                  <rich-text preview selectable nodes={getContent(good.meal_details)} />
                </View>}
                {TARO_ENV === 'h5' && <Text style='display: inline-block;' selectable className='content-info'>
                  {!!good.meal_details &&
                  <View id='html-notice' dangerouslySetInnerHTML={{__html: good.meal_details}} />}
                </Text>}
              </View>
            </View>}
            <View className='detail-content ScrollTo no-top'>
              <View className='rich-content' id='notice'>
                <View className='content-header'><View className='line'
                  style={`background-color: ${process.env.mainColor}`}
                /><View
                  className='title'
                >购买须知</View></View>
                {TARO_ENV === 'weapp' && <View className='content-info'>
                  <parser selectable html={notices || ''} />
                </View>}
                {TARO_ENV === 'tt' && <View className='content-info'>
                  <rich-text preview selectable nodes={getContent(notices)} />
                </View>}
                {TARO_ENV === 'h5' && <Text style='display: inline-block;' selectable className='content-info'>
                  {!!notices && <View id='html-notice' dangerouslySetInnerHTML={{__html: notices}} />}
                </Text>}
              </View>
            </View>
            <View className='detail-content ScrollTo'>
              <View className='rich-content' id='description'>
                <View className='content-header'><View className='line'
                  style={`background-color: ${process.env.mainColor}`}
                /><View
                  className='title'
                >图文介绍</View></View>
                {TARO_ENV === 'weapp' && <View className='content-info'>
                  <parser selectable html={description || ''} />
                </View>}
                {TARO_ENV === 'tt' && <View className='content-info'>
                  <rich-text preview selectable nodes={getContent(description)} />
                </View>}
                {TARO_ENV === 'h5' && <Text style='display: inline-block;' selectable className='content-info'>
                  {!!description && <View id='html-notice' dangerouslySetInnerHTML={{__html: description}} />}
                </Text>}
              </View>
            </View>
          </Block>}
          {process.env.P_ENV === 'kd' && <Block>
            {good.meal_details && <View className='detail-content ScrollTo no-top'>
              <View className='rich-content' id='meal'>
                <View className='content-header'>
                  <View className='line' style={`background-color: ${process.env.mainColor}`} />
                  <View className='title'>套餐包含</View>
                </View>
                {TARO_ENV === 'weapp' && <View className='content-info'>
                  <parser selectable html={good.meal_details || ''} />
                </View>}
                {TARO_ENV === 'tt' && <View className='content-info'>
                  <rich-text preview selectable nodes={getContent(good.meal_details)} />
                </View>}
                {TARO_ENV === 'h5' && <Text style='display: inline-block;' selectable className='content-info'>
                  {!!good.meal_details &&
                  <View id='html-notice' dangerouslySetInnerHTML={{__html: good.meal_details}} />}
                </Text>}
              </View>
            </View>}
            <View className='detail-content ScrollTo no-top'>
              <View className='rich-content' id='description'>
                <View className='content-header'><View className='line'
                  style={`background-color: ${process.env.mainColor}`}
                /><View
                  className='title'
                >图文介绍</View></View>
                {TARO_ENV === 'weapp' && <View className='content-info'>
                  <parser selectable html={description || ''} />
                </View>}
                {TARO_ENV === 'tt' && <View className='content-info'>
                  <rich-text preview selectable nodes={getContent(description)} />
                </View>}
                {TARO_ENV === 'h5' && <Text style='display: inline-block;' selectable className='content-info'>
                  {!!description && <View id='html-notice' dangerouslySetInnerHTML={{__html: description}} />}
                </Text>}
              </View>
            </View>
            <View className='detail-content ScrollTo'>
              <View className='rich-content' id='notice'>
                <View className='content-header'><View className='line'
                  style={`background-color: ${process.env.mainColor}`}
                /><View
                  className='title'
                >购买须知</View></View>
                {TARO_ENV === 'weapp' && <View className='content-info'>
                  <parser selectable html={notices || ''} />
                </View>}
                {TARO_ENV === 'tt' && <View className='content-info'>
                  <rich-text preview selectable nodes={getContent(notices)} />
                </View>}
                {TARO_ENV === 'h5' && <Text style='display: inline-block;' selectable className='content-info'>
                  {!!notices && <View id='html-notice' dangerouslySetInnerHTML={{__html: notices}} />}
                </Text>}
              </View>
            </View>
          </Block>}
          {openMp && !pkeys && <View className='detail-content'><Subscription data={openMp} /></View>}
          {evaluationList.length > 0 && <View className='evaluation-goods-box ScrollTo' id='evaluation'>
            <View className='good'>
              <Evaluation recordsTotal={recordsTotal} data={evaluationList} category={0} productId={good.id} product_no={good.no} />
            </View>
          </View>}
          {((good.b_scanning && good.b_scanning.length > 0) || process.env.DETAIL_SHOW_NO) && <View className='good-info-box'>
            {good.b_scanning && good.b_scanning.length > 0 && <View onClick={this.handlerPreviewImage.bind(this, good.b_scanning, good.b_scanning[0])} className='good-info-item' style='justify-content: space-between'>
              <View>商家资质</View>
              <View><AtIcon value='chevron-right' size={16} color='#000' /></View>
            </View>}
            {process.env.DETAIL_SHOW_NO && <View className='good-info-item'>
              <View className='_no'>编号：{good.no}</View>
            </View>}
          </View>}
          {recommendGood.length > 0 && <View className='recommend-goods-box ScrollTo' id='recommend'>
            <View className='content-header'><View className='line'
              style={`background-color: ${process.env.mainColor}`}
            /><View
              className='title'
            >猜你喜欢</View></View>
            <View className='good'>
              <Category itemsNoPaddingLR='true' pkeys={pkeys} isUser={isUser} data={recommendGood} />
            </View>
          </View>}
        </View>
        {TARO_ENV === "weapp" && good.live_room_id && <LiveBar roomId={good.live_room_id} />}
        <SupportBar />
        <View style={{height: "70px"}} />
        <LimitBar
          subscribe={is_subscribe}
          notOpen={notOpen}
          groupBuyId={groupBuyId}
          upDataDetail={upDataDetail}
          commissionPrice={upDataDetail.commission_price}
          isShowShareButton={isShowShareButton}
          showLoading={showLoading}
          groupDetail={groupDetail}
          isOpened={false}
          bdInfo={bdInfo}
          good={good}
          isLogin={isLogin}
          surplusStock={good.surplus_stock}
          uuid={good.uuid}
          platformSet={platformSet}
          isInStoreHouse={upDataDetail.isInStoreHouse}
          oneMinute={oneMinute}
          isSaler={Boolean(upDataDetail && upDataDetail.isSeller)}
          inSale={Boolean(good.is_pub)}
          zeroBuy={upDataDetail.can_zero_buy}
          showService={Boolean(good.is_show_customer_service)}
          getMSG={this.getMSG.bind(this)}
          removeMSG={this.removeMSG.bind(this)}
          onViewMyTeam={() => {
            if (!isLogin) {
              user.jumpLogin()
            } else {
              Taro.navigateTo({url: `/common/group/detail?orderNum=${groupDetail.order_num}&category=0&itemId=${this.state.goodUuid}`})
            }
          }}
          onJoinGroup={async () => {
            const data = await http.HPost(ACTIVITY_CHECK, {group_buy_id: this.state.groupBuyId})
            if (!data) {
              return
            }
            const {goodUuid, groupBuyId} = this.state
            const gooddata = {}
            const goodId = good.id
            gooddata['img'] = good.images[0].url
            gooddata['name'] = good.name
            gooddata['price'] = good.price
            gooddata['images'] = good.images
            Taro.setStorage({
              key: "placeOrder",
              data: JSON.stringify(gooddata),
              success: async () => {
                if (!isLogin) {
                  user.jumpLogin()
                } else {
                  if (good.isSelf) {
                    Taro.navigateTo({url: `/main/order/place?${this.getParams()}itemId=` + goodId + `&m=limited&activityId=${groupDetail.activity_id}&isLeader=false&stepNum=${groupDetail.step_num}&groupPrice=${groupDetail.group_price}&goodUuid=${goodUuid}&groupBuyId=${groupBuyId}`})
                  } else {
                    Taro.navigateTo({url: `/main/order/confirm?${this.getParams()}itemId=` + goodId + '&m=limited' + '&tempSellerId=' + tempSellerId + `&activityId=${groupDetail.activity_id}&isLeader=false&stepNum=${groupDetail.step_num}&groupPrice=${groupDetail.group_price}&goodUuid=${goodUuid}&groupBuyId=${groupBuyId}`})
                  }
                }
              }
            })
          }}
          onGroupBuy={async (stepNum = 0, groupPrice = 0) => {
            if (this.checkJump()) {
              const data = await http.HPost(OPEN_ACTIVITY_CHECK, {activity_id: groupDetail.activity_id})
              if (data.data !== '校验通过') {
                return
              }
              const {goodUuid} = this.state
              const gooddata = {}
              const goodId = good.id
              gooddata['img'] = good.images[0].url
              gooddata['name'] = good.name
              gooddata['price'] = good.price
              gooddata['images'] = good.images
              Taro.setStorage({
                key: "placeOrder",
                data: JSON.stringify(gooddata),
                success: async () => {
                  if (!isLogin) {
                    user.jumpLogin()
                  } else {
                    if (good.isSelf) {
                      Taro.navigateTo({url: `/main/order/place?${this.getParams()}itemId=` + goodId + `&m=limited&activityId=${groupDetail.activity_id}&isLeader=true&stepNum=${stepNum}&groupPrice=${groupPrice}&goodUuid=${goodUuid}`})
                    } else {
                      Taro.navigateTo({url: `/main/order/confirm?${this.getParams()}itemId=` + goodId + '&m=limited' + '&tempSellerId=' + tempSellerId + `&activityId=${groupDetail.activity_id}&isLeader=true&stepNum=${stepNum}&groupPrice=${groupPrice}&goodUuid=${goodUuid}`})
                    }
                  }
                }
              })
            }
          }}
          onGotoBuy={() => {
            if (this.checkJump()) {
              const {limitGoodsId, goodsDiscountCodeType, goodsDiscountCodeId} = this.state
              const gooddata = {}
              gooddata['img'] = good.images[0].url
              gooddata['name'] = good.name
              gooddata['price'] = good.price
              gooddata['images'] = good.images
              Taro.setStorage({
                key: "placeOrder",
                data: JSON.stringify(gooddata),
                success: async () => {
                  if (!isLogin) {
                    user.jumpLogin()
                  } else {
                    if (good.meal_valid_type && checkmeal.length < good.meal_valid_num) {
                      Taro.showToast({
                        title: `您还需选${good.meal_valid_num - checkmeal.length}个套餐`,
                        icon: 'none',
                        duration: 2000
                      })
                    } else {
                      const mealArrId = []
                      checkmeal.map(item => {
                        mealArrId.push(item.id)
                      })
                      Taro.setStorageSync("checkmeal", checkmeal)
                      if (process.env.TARO_ENV === 'tt' && upDataDetail.douyinGoodsType != 0) {
                        return Taro.navigateTo({url: `/pay/payReplaceZJpay/index?id=${good.id}&uuid=${good.uuid}&douyin_product_type=${upDataDetail.douyinGoodsType}&bd_type=${bdInfo.type}`})
                      }
                      if (process.env.TARO_ENV !== 'tt' && good.isSelf) {
                        Taro.navigateTo({url: `/main/order/place?${this.getParams()}itemId=` + good.id + `&m=limited&fromOrderNum=${orderNum}&limitGoodsId=${limitGoodsId}&goodsDiscountCodeType=${goodsDiscountCodeType}&goodsDiscountCodeId=${goodsDiscountCodeId}`})
                      } else {
                        Taro.navigateTo({url: `/main/order/confirm?${this.getParams()}itemId=` + good.id + '&m=limited&meal=' + mealArrId.join(",") + '&zero=' + upDataDetail.can_zero_buy + '&tempSellerId=' + tempSellerId + `&fromOrderNum=${orderNum}&limitGoodsId=${limitGoodsId}&goodsDiscountCodeType=${goodsDiscountCodeType}&goodsDiscountCodeId=${goodsDiscountCodeId}`})
                      }
                    }
                  }
                }
              })
            }
          }}
          onGotoHome={() => {
            if (this.checkJump()) {
              if (TARO_ENV === 'h5') {
                let mpkey = ''
                const uInfo = Taro.getStorageSync('user') || ''
                if (uInfo && uInfo.mpkey && uInfo.mpkey !== 'undefined') {
                  mpkey = uInfo.mpkey
                }
                window.location.replace(window.location.origin + '/pages/index/index?mpkey=' + mpkey)
              } else {
                Taro.switchTab({url: '/pages/index/index'})
              }
            }
          }}
          status={goodStatus}
          disabled={btnDisabled}
          onGetPoster={throttle(this.getPoste.bind(this), 200)}
          onContact={() => {
            if (!isLogin) {
              return user.jumpLogin()
            }
            Taro.navigateTo({url: `/distributor/contact/contact${sitePhone ? '?phone=' + sitePhone + (siteServiceWx ? '&weixin=' + siteServiceWx : '') : (siteServiceWx ? '?weixin=' + siteServiceWx : '')}`})
          }}
          onOpenModel={this.onOpenModel.bind(this)}
          handleCancel={this.handleCancel.bind(this)}
          qrImg={qrImg}
          qrImgDescribe={qrImgDescribe}
          onWXOpenModel={this.onWXOpenModel.bind(this)}
          wxModalShow={wxModalShow}
          wxhandleCancel={this.wxhandleCancel.bind(this)}
          wxQrImg={wxQrImg}
        />
        {isOpened && <AtModal className='model' isOpened={isOpened} onClose={() => {
          this.setState({isOpened: false})
        }}
        >
          <AtModalHeader>购买须知<AtIcon onClick={() => {
            this.setState({isOpened: false})
          }} className='close-cla' value='close' size='20' color='#888888'
          /></AtModalHeader>
          <View className='w-b-ba'>
            <ScrollView
              style={`min-height:${minHeight + 'px'};max-height:${minHeight + 'px'}`}
              className='scrollView'
              scrollY
            >
              {process.env.TARO_ENV === "weapp" && <parser selectable html={good.purchase_information || ''} />}
              {process.env.TARO_ENV === "tt" && <rich-text preview selectable nodes={getContent(good.purchase_information)} />}
              {process.env.TARO_ENV === "h5" && !!good.purchase_information &&
              <View className='gmxz' dangerouslySetInnerHTML={{__html: good.purchase_information}} />}
            </ScrollView>
          </View>
          <AtModalAction><Button onClick={() => {
            this.setState({isOpened: false})
          }} className='readed'
          >已阅读并确定</Button></AtModalAction>
        </AtModal>}
        <AtFloatLayout isOpened={floatLayout} title='购买须知' scrollY onClose={() => {
          this.setState({floatLayout: false})
        }}
        >
          <View className='float-layout'>
            {process.env.TARO_ENV === "weapp" && <parser html={notice || ''} />}
          </View>
        </AtFloatLayout>
        {!showLoading &&
        <MakePoster pkeys={pkeys} category={0} commissionPrice={upDataDetail.commission_price} power={power}
          userPower={userPower} sloganList={sloganList}
          shareSetting={shareSetting} cref={this.posterRef}
          friendsArr={good.images} posterType='limit' uuid={good.uuid} text={good.slogan}
          itemId={good.uuid}
          showButton={false} onGetPoster={async () => {
          await this.onGetPoster()
        }}
        />}
        {!showLoading &&
        <PopView commissionPrice={good.commission_price} isSeller={Boolean(upDataDetail && upDataDetail.isSeller)}
          popInfo={popInfo} offsetTop={searchBarTop * 2 + 50 + 'rpx'}
        />}
        <AtFloatLayout isOpened={showAppointment} onClose={() => {
          this.setState({showAppointment: false})
        }}
        >
          <AtCalendar validDates={calendarArr} />
        </AtFloatLayout>
        {!!good.open_meal && good.meals && good.meals.length > 0 &&
        <Block><AtFloatLayout className='meals' isOpened={openGroup}
          title={`套餐包含 （${checkmeal.length + '/' + good.meals.length}），共需选${good.meal_valid_num || 0}个`}
          onClose={this.handleClickGroup.bind(this)} scrollY
        >
          {good.meals.map((val, i) =>
            <View className='group-item' key={i}>
              <View className='group-name'>
                <View className='wrapper'>
                  <View className='meals-items' onClick={this.checkMeal.bind(this, i)}>
                    <View className='pro-name'><Image
                      src='https://resource.ivcheng.com/upload/images/20210825/1629895457993_541.png'
                      mode='aspectFill' className='img'
                    /><Text className='name'>{val.productName}</Text></View>
                    {good.meal_valid_type == 1 &&
                    <View className={`m-r group-check ${val.check && 'no-border-t'}`}>{val.check &&
                    <View className='checkbox__input is-checked'><View className='checkbox__inner'
                      style='background-color: #f0a33f;'
                    /></View>}{((checkmeal.length == good.meal_valid_num) && good.meal_valid_num != 1) &&
                    <View className='disable' />}</View>}
                  </View>
                  <View className='items-bottom'>
                    <View><Text className='label'>数量</Text>{val.amount}</View>
                    {val.validDate && !good.meal_valid_date_set &&
                    <View><Text className='label'>有效时间</Text>{val.validDate}</View>}
                  </View>
                  {!!val.is_need_reserve && <View className='meal_time meal-items'>
                    <View className='label'>需预约</View>
                  </View>}
                </View>
              </View>
            </View>
          )}
        </AtFloatLayout>
          {openGroup && <View className='goPey' onClick={this.goPey.bind(this)}>确定</View>}
        </Block>}
        {!showLoading && process.env.TARO_ENV === 'tt' && <JoinTt />}
        {/*{upDataDetail.bd_spu_id && process.env.TARO_ENV === 'tt' && <Button style='z-index: 666; position: fixed; bottom: 24%; right: 10px; color: initial; padding: 0; margin: 0; background: initial; font-size: initial; border-radius: initial; line-height: inherit;' open-type='share' data-channel='video'><Image mode='widthFix' style='width: 66px;' src={RESOURCE_URL + '/upload/images/002f11e7-9283-411f-bd4e-1373fb1463d7.jpg'} /></Button>}*/}
      </View>
    )
  }
}

export default DetailWeb as ComponentClass<PageOwnProps, PageState>;

